import type { IEditCouponData, ICouponStatics, IEditCouponBatchData, ICouponClaimStatics, IVerifyCouponStatics } from "@/api/modules/marketingTool";
import { request } from "@/utils/request";
import ApiResult from "./base/ApiResult";

/**
 * 获取优惠券管理统计
 */
export function getCouponDefineStatics(data):Promise<ApiResult<ICouponStatics>> {
  return request('merchant/coupon/couponDefineStatics', data);
}

/**
 * 删除优惠券
 */
export function deleteCouponDefine(data: {id: number}):Promise<ApiResult<null>> {
  return request('merchant/coupon/delCouponDefine', data);
}

/**
 * 更新优惠券状态
 */
export function updateCouponDefineStatus(data: {id: number, status: 1 | 0}):Promise<ApiResult<null>> {
  return request('merchant/coupon/updateCouponDefineStatus', data)
}

/**
 * 保存或更新优惠券
 */
export function saveOrUpdateCouponDefine(data: IEditCouponData):Promise<ApiResult<null>> {
  return request('merchant/coupon/saveOrUpdateCouponDefine', data);
}

/**
 * 获取单个优惠券详情
 */
export function getOneCouponDefine(data: {id: string}):Promise<ApiResult<IEditCouponData>> {
  return request('merchant/coupon/getOneCouponDefine', data);
}

/**
 * 新增或编辑优惠券批次
 */
export function saveOrUpdateCouponBatch(data: IEditCouponBatchData):Promise<ApiResult<null>> {
  return request('merchant/coupon/saveOrUpdateCouponBatch', data)
}

/**
 * 获取单个优惠券批次
 */
export function getOneCouponBatch(data: {id: string}):Promise<ApiResult<IEditCouponBatchData>> {
  return request('merchant/coupon/getOneCouponBatch', data)
}

/**
 * 删除优惠券批次
 */
export function deleteCouponBatch(data: {id: number}):Promise<ApiResult<null>> {
  return request('merchant/coupon/delCouponBatch', data)
}

/**
 * 优惠券批次状态更新
 */
export function updateCouponBatchStatus(data: {id: number, status: 1 | 0}):Promise<ApiResult<null>> {
  return request('merchant/coupon/updateCouponBatchStatus', data)
}

/**
 * 审核优惠券
 */
export function verifyCoupon(data: {id: number, remark: string}):Promise<ApiResult<null>> {
  return request('merchant/coupon/verifyCoupon', data)
}

/**
 * 优惠券领取明细统计
 */
export function getCouponClaimStatics(data):Promise<ApiResult<ICouponClaimStatics>> {
  return request('merchant/coupon/receiveCouponStatics', data)
}

/**
 * 优惠券审核统计
 */
export function getVerifyCouponBatchStatics():Promise<ApiResult<IVerifyCouponStatics>> {
  return request('merchant/coupon/verifyCouponBatchStatics', {})
}